<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" href="../style.css" type="text/css" media="all" />
<body>
<h1>SimpleTemplate</h1>
<div class="class_description">Этот класс используется для обработки простых шаблонов, где все переменные подставляются заменой</div>
<h2>Методы</h2><ul><li><a href="#display">display</a></li><li><a href="#setVar">setVar</a></li><li><a href="#__construct">__construct</a></li></ul><a name="display"></a>
<h3>display</h3>
<div class="block description">
<h4>Описание</h4>
<div class="text method_description">
<div class="prototype"><span class="return">string</span> <span class="name">display</span> ()</div><p>Получить обработанный контент шаблона</p>
</div>
</div><a name="setVar"></a>
<h3>setVar</h3>
<div class="block description">
<h4>Описание</h4>
<div class="text method_description">
<div class="prototype"><span class="return">void</span> <span class="name">setVar</span> (<span class="type">string</span> <span class="varname">$varName</span>, <span class="type">mixed</span> <span class="varname">$value</span>)</div><p>Установить переменную</p>
</div>
</div><div class="block parametrs">
<h4>Параметры</h4>
<div class="text parametrs"><dl class="var_description">
	<dt>varName</dt>
	<dd>имя переменной</dd>
</dl><dl class="var_description">
	<dt>value</dt>
	<dd>значение переменной</dd>
</dl>
</div>
</div><a name="__construct"></a>
<h3>__construct</h3>
<div class="block description">
<h4>Описание</h4>
<div class="text method_description">
<div class="prototype"><span class="return">void</span> <span class="name">__construct</span> (<span class="type">string</span> <span class="varname">$sTemplatePath</span>)</div><p>Конструктор</p>
</div>
</div><div class="block parametrs">
<h4>Параметры</h4>
<div class="text parametrs"><dl class="var_description">
	<dt>sTemplatePath</dt>
	<dd>относительный путь до шаблона (~/explay/templates/simple/)</dd>
</dl>
</div>
</div><h2>Примеры</h2><div class="sample">
<p>Пример №1</p>
<div class="sample_content"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">//&nbsp;метод&nbsp;некого&nbsp;модуля...<br /><br /></span><span style="color: #0000BB">$template&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">SimpleTemplate&nbsp;</span><span style="color: #007700">(</span><span style="color: #DD0000">'my_module/template.tpl'</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;~/explay/templates/simple/my_module/template.tpl:<br />//&nbsp;Привет,&nbsp;{name}!&nbsp;Твой&nbsp;e-mail&nbsp;{email}<br /><br /></span><span style="color: #0000BB">$oUser&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ExplaySession</span><span style="color: #007700">::</span><span style="color: #0000BB">getUser&nbsp;</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">$template</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setVar&nbsp;</span><span style="color: #007700">(</span><span style="color: #DD0000">'{name}'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$oUser</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getValue&nbsp;</span><span style="color: #007700">(</span><span style="color: #DD0000">'name'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">$template</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setVar&nbsp;</span><span style="color: #007700">(</span><span style="color: #DD0000">'{email}'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$oUser</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getValue&nbsp;</span><span style="color: #007700">(</span><span style="color: #DD0000">'email'</span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">flush&nbsp;</span><span style="color: #007700">(</span><span style="color: #0000BB">$template</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">display&nbsp;</span><span style="color: #007700">(),&nbsp;</span><span style="color: #DD0000">'text/plain'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Выведет:&nbsp;Привет,&nbsp;Lauri!&nbsp;Твой&nbsp;e-mail&nbsp;golovdinov@gmail.com<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
</div></body>
</html>